<template>
  <div
    :style="{
      left: positionPOI[0] + 104 + 'px',
      top: positionPOI[1] - 273 + 'px',
    }"
    class="wrap"
    @click="closeDialog"
  >
    ×
  </div>
  <!-- <div
    :style="{ left:500 + 'px', top: 700 + 'px' }"
    class="wrap"
  >
    ×
  </div> -->
</template>

<script>
import { mapState } from "vuex";
export default {
  mounted() {
    console.log(this.position, "1234");
  },
  methods: {
    closeDialog() {
      console.log(this.dialogInfo);
      let tagArr = localStorage.getItem("tagArr");
      tagArr = JSON.parse(tagArr);
      tagArr.map((item) => {
        if (item.id == this.dialogInfo.id) item.show = 1;
        return item;
      });
      const { coordinate, text } = this.dialogInfo;
      let page =
        HostConfig.AbsolutePath + `/int_custom_tag.html?title=${text}&show=1`;
      let contentWeb = new WebUIData(page, 220, 52);
      let popupWeb = new WebUIData(
        HostConfig.AbsolutePath + `/int_popup.html?title=${text}`,
        600,
        480
      );
      let pivot = [0.5, 0.5];
      let range = [1, 5000];
      let o = new CustomTagData(
        this.dialogInfo.id,
        coordinate,
        contentWeb,
        popupWeb,
        pivot,
        range
      );
      // setTimeout(() => {
        __g.ctag.update(o).then((res) => {
           __g.tag.hidePopupWindow(this.dialogInfo.id);
          this.$store.commit("positionPOI",[])
          localStorage.setItem("tagArr", JSON.stringify(tagArr));
        });
      // }, 1000);
    },
  },
  computed: {
    ...mapState(["positionPOI", "dialogInfo"]),
  },
};
</script>

<style scoped lang="scss">
.wrap {
  position: fixed;
  width: 10px;
  height: 10px;
  text-align: center;
  // background: url("./travel2_pop.png") no-repeat 0 0;
  // background-size: 100% 100%;
  color: #fff;
}
</style>